import React from 'react';
import {render} from 'react-dom';
import {hashHistory, Router, Route, IndexRedirect, Redirect,useRouterHistory} from 'react-router';
import { createHashHistory } from 'history';

import {App} from './scripts/App.react';
import MallList from './modules/mallList/list';
import Product from './modules/prodcut/productDetails';
import MyOrder from './modules/myOrder/myOrder';
import OrderDetails from './modules/orderDetails/orderDetails';
import Address from './modules/address/address';
import Voucher from './modules/voucher/voucher';
import  PaySuccess from './modules/paySuccess/paySuccess';
import PresetOrderDetail from './modules/presetOrderDetail/presetOrderDetail'
import Login from './modules/login/login'

// TODO remove
const appHashHistory = useRouterHistory(createHashHistory)({ queryKey: false });

render(
        <div>
            <Router history={appHashHistory}>
                <Route path="/" component={App}>
                    <IndexRedirect to="/mall/list" />

                    <Route  path="mall">
                        <Route path="list" component={MallList} />
                        <Route path="productDetails" component={Product} />
                        <Route path="myOrder" component={MyOrder} />
                        <Route path="orderDetails" component={OrderDetails} />
                        <Route path="presetOrderDetail" component={PresetOrderDetail} />
                        <Route path="address" component={Address} />
                        <Route path="voucher" component={Voucher} />
                        <Route path="paySuccess" component={PaySuccess} />
                        <Route path="login" component={Login} />
                    </Route>
                </Route>
            </Router>
        </div>,
    document.getElementById("container")
);  